package QiYi;

/**
 * Description：
 * Author: zhangc
 * Date：2017/9/10 20:29
 */

import java.util.Scanner;

public class Main {


    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        String str = in.nextLine();

        int rn = 0;
        int gn = 0;
        int len = str.length();

        for (int i = 0; i < len; i++) {
            if (str.charAt(i) == 'R') {
                rn++;
            }
        }

        int i = 0;
        int count = 0;
        for (; i < rn; i++) {
            if (str.charAt(i) == 'G') {
                count++;
            }
        }
        for (; i < len; i++) {
            if (str.charAt(i) == 'R') {
                count++;
            }
        }
        System.out.println(count);
    }

}